<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <form class="form-horizontal" action="/family/save"  method="post">
    <fieldset>
    
    	<div class="control-group">
          	<label class="control-label">家族名称：</label>
			<input type="hidden" value="${family.id }" name="id"/>
          <div class="controls">
            <input type="text" id="name" name="name" value="${family.name }">
          </div>
        </div>
        
        <div class="control-group">
          	<label class="control-label">家族QQ：</label>
          	<div class="controls">
            	<input type="text" name="qq" value="${family.qq }">
          	</div>
        </div>
        
		<div class="control-group">
          	<label class="control-label">家族YY：</label>
          	<div class="controls">
            	<input type="text" name="yy" value="${family.yy }">
          	</div>
        </div>
        
        <div class="control-group">
	         <label class="control-label">线路：</label>
	         <div class="controls">
			     <select id="line" name="line">
            		<option value="01">双线</option>
            		<option value="02">电信</option>
            		<option value="02">网通</option>
            	</select>
	  		 </div>
		  </div>
        
        
        <div class="control-group">
          	<label class="control-label">家族族长：</label>
          	<div class="controls">
            	<input type="text" name="leader" value="${family.leader }">
          	</div>
        </div>
        
        <div class="control-group">
		     <label class="control-label" for="input01">创建时间：</label>
		        <div class="controls">
		           <input type="text" class="input-xlarge Wdate" name="created" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true})" value="${family.created }">
		      </div>
		</div>
		
		<div class="control-group">
          	<label class="control-label">主页：</label>
          	<div class="controls">
            	<input type="text" name="site" value="${family.site}">
          	</div>
        </div>
		
		<div class="control-group">
          	<label class="control-label">点击率：</label>
          	<div class="controls">
            	<input type="text" name="clicks" value="${family.clicks}">
          	</div>
        </div>
        
        <c:if test="${not empty admin }">
        <div class="control-group">
          	<label class="control-label">审核状态：</label>
          	<div class="controls">
            	<select id="status" name="status">
            		<option value="01">未审核</option>
            		<option value="02">已审核</option>
            	</select>
          	</div>
        </div>
        
        <div class="control-group">
          	<label class="control-label">位置：</label>
          	<div class="controls">
            	<select id="place" name="place">
            		<option value="01">普通</option>
            		<option value="02">置顶</option>
            	</select>
          	</div>
        </div>
        </c:if>
    	<div class="control-group">
	        <div class="controls">
	            <button class="btn btn-default" type="submit">确定</button>
	        </div>
        </div>

    </fieldset>
  </form>

<script type="text/javascript">

 $(document).ready(function() {
	$('#line').val('${family.line}');
	$('#status').val('${family.status}');
  	$('form').ajaxForm({
		beforeSubmit:function(){
			return $('form').validate().form();
		},
		success:function(){
			$('#div_right').load("/family/manage");
		}
	});
  	
  	$("form").validate({
		rules: {
			name: {required:true,maxlength:30,minlength:3,remote:"/family/check"},
			qq: {required:true,maxlength:20},
			yy: {required:true,maxlength:20},
			created: {required:true},
			site: {required:true,url:true}
		},
		messages: {
			name: {required:"请填写家族名称",maxlength:"不能长于30个字",minlength:"请输入至少3个字符",remote:"该名称存在"},
			qq: {required:"请填写QQ",maxlength:20},
			yy: {required:"请填写YY",maxlength:20},
			created: {required:"请填写创建时间"},
			site: {required:"请填写主页",url:"请填写规范的主页"}
		}
	});
 });

</script>
